preserve
qui: replace degree_reces = degree_reces*100
qui: replace degree_recov = degree_recov*100
qui: replace depth_reces = depth_reces*100
qui: replace depth_recov = depth_recov*100

qui: sum length_reces, detail
mat A1 = r(mean)
mat A2 = r(sd)
mat A3 = r(max)
mat A4 = r(min)

qui: sum depth_reces, detail
mat B1 = r(mean)
mat B2 = r(sd)
mat B3 = r(max)
mat B4 = r(min)

qui: sum degree_reces, detail
mat C1 = r(mean)
mat C2 = r(sd)
mat C3 = r(max)
mat C4 = r(min)

qui: sum length_recov, detail
mat D1 = r(mean)
mat D2 = r(sd)
mat D3 = r(max)
mat D4 = r(min)

qui: sum depth_recov, detail
mat E1 = r(mean)
mat E2 = r(sd)
mat E3 = r(max)
mat E4 = r(min)

qui: sum degree_recov, detail
mat F1 = r(mean)
mat F2 = r(sd)
mat F3 = r(max)
mat F4 = r(min)

matrix A = (A1[1,1], A2[1,1], A3[1,1], A4[1,1] \ B1[1,1], B2[1,1], B3[1,1], B4[1,1] \ C1[1,1], C2[1,1], C3[1,1], C4[1,1] \ D1[1,1], D2[1,1], D3[1,1], D4[1,1] \ E1[1,1], E2[1,1], E3[1,1], E4[1,1] \ F1[1,1], F2[1,1], F3[1,1], F4[1,1])
matrix colnames A = Mean Std_dev Max Min
matrix rownames A = Length_Recession Depth_Recession Intensity_Recession Length_Recovery Depth_Recovery Intensity_Recovery
outtable using ${tables}/TableSummaryStatistics${version}, mat(A) replace center f(%5.2f) 

qui: by amr, sort: egen ncycles = max(id_lbc)
qui: keep ncycles amr
qui: duplicates drop
histogram ncycles, discrete addlabels graphregion(color(white)) lcolor(black) fcolor(black) xtitle("Number of local cycles")
graph export ${graphs}/frequencylocalcycles${version}.png, replace
restore

